package cn.buyclss.backend.constant;

/**
 * @author: Cecurio
 * @create: 2019-02-10 17:44
 **/
public enum UserTypeEnum {
    // 1为买家，2为商户，3为管理员
    BUYER("买家", 1), MERCHANT("商户", 2), ADMINISTRATOR("管理员", 3);

    // 成员变量  
    private String name;
    private int index;

    // 构造方法  
    private UserTypeEnum(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public static String getName(int index) {
        for (UserTypeEnum u : UserTypeEnum.values()) {
            if (u.getIndex()==index) {
                return u.name;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }
}
